//
//  YLLStatusModel.swift
//  YLLSina
//
//  Created by 于玲玲 on 16/8/1.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit

class YLLStatusModel: NSObject {

    var created_at: String?
    
    var id: Int = 0
    
    var text:String?
    
    var source: String?
    
    var user: YLLStatusUserModel?
    
    
    // 如果该字段为 nil,则说明此微博为原创微博
    // 如果该字段为 不为nil,则说明此微博为转发微博
    ///    retweeted_status	object	被转发的原微博信息字段，当该微博为转发微博时返回 详细
    var retweeted_status:YLLStatusModel?
    //   retweeted_status	object	被转发的原微博信息字段，当该微博为转发微博时返回 详细
    ///    reposts_count	int	转发数
    var reposts_count: Int = 0
    ///    comments_count	int	评论数
    var comments_count: Int = 0
    ///    attitudes_count	int	表态数
    var attitudes_count: Int = 0
    
    var pic_urls: [YLLPhotoModel]?
    
    
    init(dict:[String: AnyObject]) {
        super.init()
        
        setValuesForKeysWithDictionary(dict)
        
        if let userDict = dict["user"] as?[String: AnyObject] {
            self.user = YLLStatusUserModel(dict: userDict)
        }
        
        if let retweeted_statusDict = dict["retweeted_status"] as?[String :AnyObject] {
            self.retweeted_status = YLLStatusModel(dict: retweeted_statusDict)
        }
        
        
        if let pic_urlsDict = dict["pic_urls"] as? [[String: AnyObject]]{
            
            self.pic_urls = [YLLPhotoModel]()
            
            for pic_urlDict in pic_urlsDict{
                
                let model = YLLPhotoModel(dict: pic_urlDict)
                
                self.pic_urls?.append(model)
            }
            
        }

    }
    
    
    
    
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
}
